#ifndef NAME_WIDGET_H
#define NAME_WIDGET_H
#include "ContainsExitForm.h"

/*

#define RESET_ELEMENTS_RECT								\
QPainter painter(this);									\
painter.setRenderHints(QPainter::Antialiasing |			\
QPainter::TextAntialiasing, true);						\
Node<UIElement>* head = _elements.currentNode();		\		
Node<UIElement>* tail = _elements.currentNode();		\
for (size_t i = 0; i < (_displayNum - 1) / 2; i++) {	\	
	head = head->prev;									\	
	tail = tail->next;									\	
}														\
Node<UIElement>* temp = head;							\
while (temp != tail) {									\
	temp = temp->prev;									\
	if (temp->data != nullptr) {						\
		temp->data->setRect(QRect(0, 0, 0, 0));			\	
	}													\
}														
*/
class NameForm :public ContainsExitForm
{
	Q_OBJECT
public:
	explicit NameForm(ElementForm* parent = nullptr);
	QString name()const;
	void setName(const QString& name);

	int diplayNum() const;
	void setDisplayNum(int displayNum);

protected:
	virtual void paintEvent(QPaintEvent* event)override;

	virtual void mouseMoveEvent(QMouseEvent* event)override;
	virtual void mouseReleaseEvent(QMouseEvent* event)override;
	virtual void updateParam();

protected:
	QString _name;
	QRect _nameRect;
	bool _isMoveFlag = false;
	int _displayNum = 0;


	
};
#endif // !NAME_WIDGET_H
